package com.itheima.zuoye2.zy1;

import lombok.*;

import java.util.Objects;

@AllArgsConstructor
@NoArgsConstructor
@ToString
@Setter
@Getter

public class Roommate {
    private String name;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Roommate roommate = (Roommate) o;
        return age == roommate.age && Objects.equals(name, roommate.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age);
    }

    private int age;

}
